/* GUI CONVERTED from rssddela.p (converter v1.75) Sat Aug 12 23:16:19 2000 */
/* rssddela.p - Release Management Supplier Schedules                   */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*F0PN*/ /*V8:ConvertMode=Maintenance                                   */
/*K1Q4*/ /*V8:WebEnabled=No                                             */
/* REVISION: 7.3    LAST MODIFIED: 04/25/94           BY: WUG *GJ59*    */
/* REVISION: 7.3    LAST MODIFIED: 11/01/94           BY: ame *GN88*    */
/* REVISION: 7.5    LAST MODIFIED: 02/27/95           BY: dpm *J044*    */
/* REVISION: 7.3    LAST MODIFIED: 03/25/96           BY: dxk *G1R3*    */
/* REVISION: 8.6    LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan */
/* REVISION: 9.1    LAST MODIFIED: 08/12/00           BY: *N0KP* myb        */


     /* DELETE A PO LINE ITEM RECORD SUBPROGRAM */

     define input parameter podnbr like pod_nbr.
     define input parameter podline like pod_line.

     find pod_det where pod_nbr = podnbr
/*G1R3      and pod_line = podline exclusive-lock.  */
/*G1R3*/    and pod_line = podline exclusive-lock no-error.

     /* This routine, when used with a remote DB, assumes that
        the line has already been replicated to the remote DB.
        This may not be the case, so we return if not found.  */

/*G1R3*/ if not available pod_det then return.

     find po_mstr where po_nbr = pod_nbr exclusive-lock.

     /*DELETE LINE ITEM COMMENTS */
/*GN88*  for each cmt_det where cmt_indx = pod_cmtindx:*/
/*GN88*/ for each cmt_det exclusive-lock where cmt_indx = pod_cmtindx:
        delete cmt_det.
     end.


     find scx_ref where scx_type = 2 and scx_shipfrom = po_vend
        and scx_shipto = pod_site and scx_part = pod_part
        and scx_po = po_nbr exclusive-lock no-error.

     if available scx_ref then delete scx_ref.

     delete pod_det.


/*J044*/ /* DELETE IMPORT EXPORT RECORDS */
/*J044*/ find first ied_det exclusive-lock where
/*J044*/    ied_type = "2" and ied_nbr = po_nbr and ied_line = podline
/*J044*/    no-error.
/*J044*/ if available ied_det then delete ied_det.

     find first pod_det where pod_nbr = po_nbr no-lock no-error.

     if not available pod_det then do:

        /*DELETE ORDER COMMENTS */
/*GN88*     for each cmt_det where cmt_indx = po_cmtindx:*/
/*GN88*/    for each cmt_det exclusive-lock where cmt_indx = po_cmtindx:
           delete cmt_det.
        end.

/*J044*/    find first ie_mstr exclusive-lock where
/*J044*/       ie_type = "2" and ie_nbr = po_nbr no-error.
/*J044*/    if available ie_mstr then  delete ie_mstr.

        delete po_mstr.
        leave.
     end.
